﻿@model USERS.CYT369.COM.MODELS.Brand.Brand
@{
    IQueryable<USERS.CYT369.COM.MODELS.Brand.Category> CateGoryParents = ViewBag.CategoryParents as IQueryable<USERS.CYT369.COM.MODELS.Brand.Category>;
    IQueryable<USERS.CYT369.COM.MODELS.Base.City> Citys = ViewBag.Citys as IQueryable<USERS.CYT369.COM.MODELS.Base.City>;
}
@using USERS.CYT369.COM.Models
@{
    Layout = "_Layout";
    ViewData["Title"] = "发布品牌";
}
@section styles {
    <link href="~/css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" />
    <link href="~/lib/jquery-easyui-1.10.0/themes/metro/easyui.css" rel="stylesheet" />
    <link href="~/lib/jquery-easyui-1.10.0/themes/color.css" rel="stylesheet" />
    <link href="~/lib/jquery-easyui-1.10.0/themes/icon.css" rel="stylesheet" />
    <link href="~/lib/ueditor1.4.3.3-utf8/themes/default/css/ueditor.min.css" rel="stylesheet" />
    <link href="~/lib/fileupload-9.18.0/jquery.fileupload.css" rel="stylesheet" />
    <link href="~/css/brand/brand-edit.css" rel="stylesheet" />
    <link href="~/css/site.css" rel="stylesheet" />
}
@section scripts {
    <script src="~/lib/jquery-easyui-1.10.0/jquery.easyui.min.js"></script>
    <script src="~/lib/jquery-easyui-1.10.0/locale/easyui-lang-zh_CN.js"></script>
    <script src="~/lib/ueditor1.4.3.3-utf8/news-ueditor.config.js"></script>
    <script src="~/lib/ueditor1.4.3.3-utf8/ueditor.all.min.js"></script>
    <script src="~/lib/fileupload-9.18.0/vendor/jquery.ui.widget.js"></script>
    <script src="~/lib/fileupload-9.18.0/load-image.all.min.js"></script>
    <script src="~/lib/fileupload-9.18.0/jquery.fileupload.js"></script>
    <script src="~/lib/fileupload-9.18.0/jquery.fileupload-process.js"></script>
    <script src="~/lib/fileupload-9.18.0/jquery.fileupload-image.js"></script>
    <script src="~/js/Common.js"></script>
    <script src="~/js/SystemSetting.js"></script>
    <script src="~/js/brand/brand-edit.js"></script>
}
<div class="easyui-layout layout" fit="true">
    <div data-options="region:'west',split:false" class="left-panel">
        <div data-options="region:'north'" class="toolbar-panel">
            <a href="~/Brand/BrandIndex" class="btns back-button">返回</a>
            <a class="btns save-button" href="javascript:SaveBrand()">保存草稿</a>
            <a class="btns active-button" href="javascript:SubmitAudit()">提交审核</a>
        </div>

        <div class="easyui-layout image-panel" data-options="fit:true,border:false">
            <div data-options="region:'north',border:false" style="height:50px;padding:10px;text-align:center">
                <span class="fileinput-button upload-btn">
                    <span>+上传图片</span>
                    <input type="file" multiple="multiple" id="_upload_img_btn" name="_upload_img_btn[]" />
                </span>
            </div>
            <div data-options="region:'center'" class="min-scrollbar" style="padding:10px">
                <form id="image-form">
                    <ul id="image-panel-list" class="image-list">
                        @if (Model != null&&Model.BrandImages!=null)
                        {
                            foreach (var brandFile in Model.BrandImages)
                            {
                                var fid = brandFile.Id;

                                <li class="image-item">
                                    <img class="img" src="@string.Format("{0}/{1}", USERS.CYT369.COM.UTILITY.SystemSettingService.Instance.NewsInternalBucket.HttpURL, brandFile.ImagePath)" />
                                    <div class="img-name">
                                        <div style="display:inline-block">
                                            <i class="fa fa-remove remove" title="删除" onclick="BrandImageDelete(this, @Model.Id, @fid)"></i>
                                            <div class="anme" title="@brandFile.Name">@brandFile.Name</div>
                                        </div>
                                    </div>
                                </li>
                            }
                        }
                    </ul>
                </form>
            </div>
        </div>
    </div>
    <div data-options="region:'center'" class="center-panel min-scrollbar">
        <form id="edit-brand-form">
            <div class="attributes-panel">
                <div class="title-panel">
                    <input type="hidden" id="Id" name="Id" value="@(Model==null?0:Model.Id)" />
                    <input type="hidden" id="EditorID" name="EditorID" value="@(ViewBag.UserID==null?0:ViewBag.UserID)" />
                    <input type="text" id="Name" name="Name" class="title" placeholder="请输入品牌名（5-100个字）" value="@(Model==null?string.Empty:Model.Name)" />
                </div>
                <div class="attributes">
                    <div class="attr-row">
                        <div class="attr-column">
                            <div class="attr-cell name-cell">投资金额：</div>
                            <div class="attr-cell value-cell">
                                <select class="easyui-combobox" style="width:300px" name="Amount" id="Amount">
                                    <option value="0">请选择投资金额</option>
                                    <option selected="@(Model==null?false:Model.Amount==1)" value="1">5万以下</option>
                                    <option selected="@(Model==null?false:Model.Amount==2)" value="2">5~10万</option>
                                    <option selected="@(Model==null?false:Model.Amount==3)" value="3">10~20万</option>
                                    <option selected="@(Model==null?false:Model.Amount==4)" value="4">20~50万</option>
                                    <option selected="@(Model==null?false:Model.Amount==5)" value="5">50~100万</option>
                                    <option selected="@(Model==null?false:Model.Amount==6)" value="6">100万以上</option>
                                </select>
                            </div>
                        </div>
                        <div class="attr-column">
                            <div class="attr-cell name-cell">加盟区域：</div>
                            <div class="attr-cell value-cell">
                                <select class="easyui-combobox" style="width:300px" name="FranchiseRegionId" id="FranchiseRegionId">
                                    @if (Citys != null)
                                    {
                                        <option value="-1" >请选择加盟区域</option>
                                        @foreach (var c in Citys)
                                        {
                                            if (Model != null && Model.FranchiseRegionID == c.Id)
                                            {
                                                <option value="@c.Id" selected>@c.CityName</option>
                                            }
                                            else
                                            {
                                                <option value="@c.Id">@c.CityName</option>
                                            }
                                        }
                                    }
                                    else
                                    {
                                        <option value="-1">暂无可选项</option>
                                    }
                                </select>
                            </div>
                       </div>
                        <div class="attr-column">
                            <div class="attr-cell name-cell">门店数量：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-textbox" id="StoreCount" name="StoreCount" type="number" data-options="prompt:'请填写品牌门店数量'" value="@(Model==null?0:Model.StoreCount)" />
                            </div>
                        </div>
                       <div class="attr-column">
                            <div class="attr-cell name-cell">主营产品：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-textbox" id="MainProduct" name="MainProduct" data-options="prompt:'请填写品牌主营产品'" value="@(Model==null?string.Empty:Model.MainProduct)" />
                            </div>
                       </div>
                        <div class="attr-column">
                            <div class="attr-cell name-cell">所属行业：</div>
                            <div class="attr-cell value-cell">
                                <select class="easyui-combobox" style="width:150px" name="ParentCategoryIds" id="ParentCategoryIds" >
                                    @if (CateGoryParents != null)
                                    {
                                        <option value="-1" disabled="disabled">请选择行业</option>
                                        @foreach(var ic in CateGoryParents)
                                        {
                                            <option value="@ic.Id">@ic.CategoryName</option>
                                        }
                                    }else
                                    {
                                        <option value="-1">暂无可选项</option>
                                    }

                                </select>
                                <input type="hidden" value="@(Model==null||Model.Category==null?-1:Model.Category.ParentID)" id="initSelectedParentID" />
                                <input type="hidden" value="@(Model==null?-1:Model.CategoryID)" id="initSelectedCategoryID" /> @* 保存初始选择的id *@
                                <select class="easyui-combobox" style="width:150px" name="ChildCategoryIds" id="ChildCategoryIds">
                                </select>
                            </div>
                   
                        </div>
                        <div class="attr-column">
                            <div class="attr-cell name-cell">适合人群：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-textbox" id="TargetAudience" name="TargetAudience" data-options="prompt:'请填写品牌适合人群'" value="@(Model==null?string.Empty:Model.TargetAudience)" />
                            </div>
                        </div>
                        <div class="attr-column">
                            <div class="attr-cell name-cell">发展模式：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-textbox" id="DevelopmentModel" name="DevelopmentModel" data-options="prompt:'请填写品牌发展模式'" value="@(Model==null?string.Empty:Model.DevelopmentModel)" />
                            </div>
                        </div>
                   
                        <div class="attr-column">
                            <div class="attr-cell name-cell">招商网址：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-textbox" id="FranchiseWebsite" name="FranchiseWebsite" data-options="prompt:'请填写招商网址链接'" style="width:300px" value="@(Model==null?string.Empty:Model.FranchiseWebsite)" />
                            </div>
                        </div>
                        <div class="attr-column">
                            <div class="attr-cell name-cell">品牌简介：</div>
                            <div class="attr-cell value-cell">
                                <input id="Brief" name="Brief" class="easyui-textbox" data-options="prompt:'品牌简介（选填）：不超过100个字符'" multiline="true" style="width:800px; height: 50px" value="@(Model==null?string.Empty:Model.Brief)" />
                            </div>
                        </div>
                    </div>
                </div>

                <div class="container-panel "> 
                    <div class="easyui-tabs">
                        <div title="品牌信息" style="padding:10px">
                            <div id="editor-text-area-BrandDetails" class="container"></div>
                        </div>
                        <div title="加盟优势" style="padding:10px">
                            <div id="editor-text-area-FranchiseAdvantages" class="container"></div>
                        </div>
                        <div title="加盟条件" style="padding:10px">
                            <div id="editor-text-area-FranchiseConditions" class="container"></div>
                        </div>
                        <div title="加盟流程" style="padding:10px">
                            <div id="editor-text-area-FranchiseProcess" class="container"></div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>